package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.db.UserInfo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//用户详情
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    //根据城市查询
    @Select("select city from tb_user_info")
    List<String> selectByCity();

    //年龄段
    @Select("select count(*) from tb_user_info where age between #{startAge} and #{endAge}")
    Integer selectByAge(Integer startAge,Integer endAge);

    //性别
    @Select("select gender from tb_user_info")
    List<String> selectByGender();

    //行业前十
    @Select("select profession from tb_user_info group by profession ORDER BY COUNT(*) DESC LIMIT 0,10")
    List<String> selectByProfession();
}